package com.zho.common.fileserver;

import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;

public interface FilesAdapter {

    /**
     * 
     */
    public void reInitial();
    
    /**
     * 
     */
    public void disconnect();

    /**
     * 
     */
    public void freeUnusedResources();

    /**
     * 
     * @param username
     * @param password
     * @return
     */
    public boolean setUserAuth(String username, String password);

    /**
     * 
     * @param pathSrc
     * @param pathDesc
     * @param isOverWrite
     * @param excludeFiles
     * @return
     * @throws Exception
     */
    public Map<String, String> copy(String pathSrc, String pathDesc, boolean isOverWrite, String[] excludeFiles) throws Exception;

    /**
     * 
     * @param pathSrc
     * @param pathDesc
     * @param isOverWrite
     * @return
     * @throws Exception
     */
    public Map<String, String> copy(String pathSrc, String pathDesc, boolean isOverWrite) throws Exception;

    /**
     * 
     * @param srcPath
     * @param dstPath
     * @throws Exception
     */
    public void copyFile(String srcPath, String dstPath) throws Exception;

    /**
     * 
     * @param srcPath
     * @param dstPath
     * @param isOverWrite
     * @return
     * @throws Exception
     */
    public Map<String, String> copyFiles(String srcPath, String dstPath, boolean isOverWrite) throws Exception;

    /**
     * 
     * @param filePath
     * @param content
     * @return
     * @throws Exception
     */
    public String createFile(String filePath, String content) throws Exception;

    /**
     * 
     * @param filePath
     * @param content
     * @return
     * @throws Exception
     */
    public String createFile(String filePath, byte[] content) throws Exception;

    /**
     * 
     * @param filePath
     * @param content
     * @return
     * @throws Exception
     */
    public String createFile(String filePath, char[] content) throws Exception;

    /**
     * 
     * @param filePath
     * @param input
     * @return
     * @throws Exception
     */
    public String createFile(String filePath, InputStream input) throws Exception;

    /**
     * 
     * @param folderPath
     * @param onSubFolder
     * @return
     * @throws Exception
     */
    public List<String> listFiles(String folderPath, boolean onSubFolder) throws Exception;

    /**
     * 
     * @param folderPath
     * @param filesType
     * @param onSubFolder
     * @return
     * @throws Exception
     */
    public List<String> listFiles(String folderPath, String[] filesType, boolean onSubFolder) throws Exception;

    /**
     * 
     * @param folderPath
     * @param onSubFolder
     * @return
     * @throws Exception
     */
    public List<String> listFolders(String folderPath, boolean onSubFolder) throws Exception;

    /**
     * 
     * @param pathSrc
     * @throws Exception
     */
    public void delete(String pathSrc) throws Exception;

    /**
     * 
     * @param pathSrc
     * @throws Exception
     */
    public void deleteFile(String pathSrc) throws Exception;

    /**
     * 
     * @param pathSrc
     * @throws Exception
     */
    public void deleteFolder(String pathSrc) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public InputStream getInputStreamFileContent(String filePath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public byte[] getByteFileContent(String filePath) throws Exception;

    /**
     * 
     * @param folderPath
     * @throws Exception
     */
    public void createFolder(String folderPath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public boolean isExist(String filePath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public boolean isFolder(String filePath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public boolean isFile(String filePath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public String getFileContent(String filePath) throws Exception;

    /**
     * 
     * @param fileNames
     * @param folderPath
     * @return
     * @throws Exception
     */
    public String findFirstFolderContainFile(String[] fileNames, String folderPath) throws Exception;

    /**
     * 
     * @param fileName
     * @return
     * @throws Exception
     */
    public String getURI(String fileName) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public URL getURL(String filePath) throws Exception;

    /**
     * 
     * @param strConnection
     * @throws FunctionalException
     */
    public void testConnection(String strConnection) throws Exception;

    /**
     * 
     * @param fileName
     * @param folderPath
     * @return
     * @throws FunctionalException
     */
    public String findFile(String fileName, String folderPath) throws Exception;

    /**
     * 
     * @param fileNames
     * @param folderPath
     * @return
     * @throws Exception
     */
    public String findFirstFileOnFolder(String[] fileNames, String folderPath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public String getMimetype(String filePath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     * @throws Exception
     */
    public String getFileType(String filePath) throws Exception;

    /**
     * 
     * @param filePath
     * @return
     */
    public long getFileSize(String filePath);
    
    /**
     * 
     * @param filePath
     * @return
     */
    public long getLastModifiedTime(String filePath);
}
